package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.pb.zhaoshang.ZhaoShangProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_ZS_PROJECT_DETAIL, desc = "项目详情")
public class ZsProjectDetailCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if(!ZsMgr.isZsSystemOpenTime()){
            ret = GameErrorCode.E_SYSTEM_NO_OPEN;
            return;
        }

        ZhaoShangProto.ZsProjectDetailReqMsg reqMsg = ZhaoShangProto.ZsProjectDetailReqMsg.parseFrom(packet.getBytes());
        ZhaoShangProto.ZsProjectDetailReqMsg.Builder crossReq = ZhaoShangProto.ZsProjectDetailReqMsg.newBuilder();
        crossReq.setProjectId(reqMsg.getProjectId());
        crossReq.setServerId(reqMsg.getServerId());
        crossReq.setGroupId(ZsMgr.getGroupId(GameServer.getInstance().getServerId()));  //分组id
        player.sendPacket(CrossProtocol.C2_ZHAO_SHANG_PROJECT_DETAIL, crossReq);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
